from typing import List
from wass.display import LANGUAGE_CODE
from wass.display import TaskType_NAME_MAP


class MetaTips(object):
    zh_cn: List = []

    en_us: List = []

    def __init__(self, code=LANGUAGE_CODE):
        lan = {
            'zh-hans': self.zh_cn,
            'zh-cn': self.zh_cn,
            'zh_cn': self.zh_cn,
            'en-us': self.en_us,
            'en_us': self.en_us
        }
        self.task_type_name_tuple = TaskType_NAME_MAP.get(LANGUAGE_CODE, {})

        self.map = lan.get(code, 'zh-hans')

    def get(self, index: int, args: tuple = (), **kwargs) -> str:
        if 'task_type' in kwargs.keys():
            kwargs['task_type'] = self.task_type_name_tuple.get(
                kwargs['task_type'], {}).get('name', kwargs['task_type'])

        return self.map[index].format(*args, **kwargs)
